<!-- 活动管理 -->
<template>
	<view class="page">
		<u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
		<view class="content" style="height: calc(100vh - 80rpx - env(safe-area-inset-bottom));">
			<swiper style="height: 100%;" :current="current" @change="chan">
				<swiper-item style="height: 100%;">
					<scroll-view scroll-y="true" style="height: 100%;" @scrolltolower="scrollToLower0">
						<view class="none" v-if="activity.length == 0">
							<image src="https://sanfuzhide.oss-cn-hangzhou.aliyuncs.com/vip/%E7%A9%BA%E7%8A%B6%E6%80%81.png"></image>
							<view class="txt">这里空空如也</view>	
						</view>
						<view class="list" style="height: 100%;">
							<ActivityManagement :item="item" v-for="item in activity" :key="item.activityId"></ActivityManagement>
						</view>
					</scroll-view>
				</swiper-item>
				<swiper-item style="height: 100%;">
					<scroll-view scroll-y="true" style="height: 100%;" @scrolltolower="scrollToLower0">
						<view class="none" v-if="activity.length == 0">
							<image src="https://sanfuzhide.oss-cn-hangzhou.aliyuncs.com/vip/%E7%A9%BA%E7%8A%B6%E6%80%81.png"></image>
							<view class="txt">这里空空如也</view>	
						</view>
						<view class="list" style="height: 100%;">
							<ActivityManagement :item="item" :identety="1" v-for="item in activity" :key="item.activityId"></ActivityManagement>
						</view>
					</scroll-view>
				</swiper-item>
			</swiper>
		</view>
	</view>
</template>

<script>
	import ActivityManagement from '@/components/activityManagement/activityManagement.vue'
	export default {
		components:{
			ActivityManagement
		},
		data() {
			return {
				list: [{
					name: '我参与的'
				}, {
					name: '我发布的'
				}],
				current: 0,
				activity:[],
				activityQurey:{
					pageNum:1,
					pegeSize:10,
					type:0
				}
			}
		},
		onLoad() {
			this.getData()
		},
		methods: {
			//初始化
			init(){
				
			},
			//滑动切换事件
			change(e){
				this.current = e
				// this.activityQurey.type = e
				// this.activity = []
				// this.activityQurey.pageNum = 1
				// this.getData()
			},
			//swiper滑动事件
			chan(e){
				this.current = e.detail.current
				this.activityQurey.type = e.detail.current
				this.activity = []
				this.activityQurey.pageNum = 1
				this.getData()
				
			},
			scrollToLower0(){
				this.activityQurey.pageNum++
				this.getData()
			},
			async getData(){
				let {data: activity} = await this.$get('/activity/ActivityManagement', this.activityQurey)
				console.log(activity)
				this.activity = this.activity.concat(activity.records)
			}
		}
	}
</script>

<style lang="scss" scoped>
.page{
		.none{
			position: absolute;
			left:50%;
			top:50%;
			transform: translate(-57%,-50%);
			image{
				width: 250rpx;
				height: 250rpx;
			}
			.txt{
				padding-top: 40rpx;
				color: #999999;
				font-size: 24rpx;
				display: flex;
				justify-content: center;
			}
		}
	.content{
		.list{
			padding: 0 30rpx;
			
		}
	}
}
</style>
